<template>
    <div>
        <h2>4.修改数组元素的解决方案</h2>

        <p>{{arr}}</p>
        <p>{{arr[0]}}</p>
        <hr>
        <p>{{obj}}</p>
        <hr>
        <button @click="hdClick">点击</button>

    </div>
</template>

<script>
    export default {
        props: {

        },
        data() {
            return {
                arr: [1, 2, 3],
                obj:{
                    name:'222'
                }
            };
        },
        methods: {
            hdClick() {
                //this.arr[0] = 11
                this.obj.name = 111

                this.$set(this.arr, 0, 11)
            }
        }
    };
</script>

<style scoped lang="less">

</style>